using System.Collections.Generic;

namespace StackCalc.Instructions
{
	/// <summary>
	/// Instruction that pushes an integer onto the stack.
	/// </summary>
	public class PushInteger : INumericInstruction
	{
		public PushInteger(int number)
		{
			NumericValue = number;
		}

		public int NumericValue { get; private set; }

		public override string ToString()
		{
			return NumericValue.ToString();
		}

		public void Execute(List<IInstruction> stack, StackEngine stackEngine)
		{
			// push onto stack
			stack.Add(this);
		}

		public string Validate(List<IInstruction> stack)
		{
			// no errors possible
			return string.Empty;
		}
	}
}
